<?php
namespace App\Transformers;
use App\Models\Collect;
use App\Models\User;
use App\Models\Write;
use League\Fractal\TransformerAbstract;

class CollectTransformer extends TransformerAbstract
{
//    protected $availableIncludes=['write','user'];
    public function transform(Collect $collect){
        return [
            'id'         =>$collect->id,
            'user_id'         =>$collect->user_id,
            'user' =>User::find($collect->user_id),
            'write_id'         =>$collect->write_id,
            'write'=>Write::find($collect->write_id),
            'created_at'         =>$collect->created_at,
            'is_locked'=>$collect->is_locked
        ];
    }

}
